<!--
 * @Author: zhangweinan
 * @Date: 2023-07-18 12:46:44
 * @LastEditors: zhangweinan
 * @LastEditTime: 2023-07-19 21:20:25
 * @Description: file content
 * @FilePath: \cty-admin\src\views\dataAnalysis\list.vue
-->
<template>
  <div class="main-page">
    <PageSearch
      :search-form-config="searchFormConfig"
      :form-data.sync="formData"
      @searchBtnClick="handleSearch"
      @exportBtnClick="handleExport"
    />
    <PageContent
      ref="pageContent"
      :form-data="formData"
      :content-table-config="contentConfig"
    >
      <template #bandwidth="scope">
        <span>{{ scope.row.bandwidth }} MB</span>
      </template>

      <template #realBandWith="scope">
        <span>{{ scope.row.realBandWith }} MB</span>
      </template>

    </PageContent>
  </div>
</template>

<script>
import { contentConfig } from "./config/content.config";
import { searchFormConfig } from "./config/search.config";
import localCache from "@/utils/cache";
export default {
  name: "OrderList",
  components: {},
  data() {
    return {
      contentConfig,
      searchFormConfig,
      btnLoading: false,
      confirmBtnLoading: false,
      formData: {}, // 搜索表单数据
      initParams: {},
    };
  },

  watch: {},
  created() {},
  methods: {
    handleSearch() {
      this.$refs.pageContent.queryTblMain();
    },
    handleExport() {
      const url = process.env.VUE_APP_BASE_API;
      this.axios({
        method: "get",
        url: url + "/bandwidth/userDailyExport",
        responseType: "blob",
        params: this.formData,
        headers: {
          Authorization: localCache.getCache("token"),
        },
      }).then((res) => {
        this.$download.excel(res.data, "收益清单.xlsx");
      });
    }
  },
};
</script>

<style lang="scss" scoped></style>
